﻿<Window x:Class="ColorDialogEx.ColorDialogExB"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:colorDialogEx="clr-namespace:ColorDialogEx"
		mc:Ignorable="d" WindowStartupLocation="CenterOwner" Title="Color Dialog" Height="455" Width="390" MinHeight="320" MinWidth="346" Background="{DynamicResource LightWindowBackground}" TextOptions.TextFormattingMode="Display" Loaded="Window_Loaded" Closing="Window_Closing">
	<Window.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="..\Styles\DarkStyleDictionary.xaml"/>
				<ResourceDictionary Source="..\Styles\LightStyleDictionary.xaml"/>
			</ResourceDictionary.MergedDictionaries>
		</ResourceDictionary>
	</Window.Resources>

	<Grid x:Name="grid">
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="260*"/>
			<ColumnDefinition Width="72"/>
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="351*"/>
			<RowDefinition Height="97"/>
		</Grid.RowDefinitions>

		<colorDialogEx:ColorDialogExCtl x:Name="ColorDialog" Grid.Row="0" Grid.ColumnSpan="1"/>

		<Rectangle x:Name="BackColorRect1" Fill="#FFF4F4F5" Margin="24,1,0,0" RenderTransformOrigin="0.5,0.5" StrokeThickness="0.5" Height="12" VerticalAlignment="Top" Grid.Row="1" HorizontalAlignment="Left" Width="48">
			<Rectangle.RenderTransform>
				<TransformGroup>
					<ScaleTransform/>
					<SkewTransform AngleX="40.693"/>
					<RotateTransform/>
					<TranslateTransform X="-0.125"/>
				</TransformGroup>
			</Rectangle.RenderTransform>
		</Rectangle>
		<Rectangle x:Name="BackColorRect2" Fill="#FFF4F4F5" Height="48" Margin="19,18,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" StrokeThickness="0.5" Grid.Row="1" HorizontalAlignment="Left" Width="10">
			<Rectangle.RenderTransform>
				<TransformGroup>
					<ScaleTransform/>
					<SkewTransform AngleY="49.447"/>
					<RotateTransform/>
					<TranslateTransform Y="-11.061"/>
				</TransformGroup>
			</Rectangle.RenderTransform>
		</Rectangle>

		<Rectangle x:Name="FrontColorRect" Fill="#FFF4F4F5" Height="48" Margin="29,13,0,0" VerticalAlignment="Top" StrokeThickness="0.5" Grid.Row="1" HorizontalAlignment="Left" Width="48"/>
		<TextBox x:Name="txtHTML" HorizontalAlignment="Right" TextWrapping="NoWrap" Width="70" FontSize="11" Height="18" VerticalAlignment="Top" Grid.Column="1" HorizontalContentAlignment="Right" Style="{DynamicResource LightTextBoxStyle}" Margin="0,2,2,0"/>
		<TextBox x:Name="txtH" HorizontalAlignment="Right" TextWrapping="NoWrap" Width="46" FontSize="11" Height="18" VerticalAlignment="Top" Grid.Column="1" Margin="0,26,2,0" KeyDown="txt_KeyDown" PreviewMouseLeftButtonDown="txtPrevMouseDown" GotFocus="txtGotFocus" Style="{DynamicResource LightTextBoxStyle}"/>
		<TextBox x:Name="txtS" HorizontalAlignment="Right" TextWrapping="NoWrap" Width="46" FontSize="11" Height="18" VerticalAlignment="Top" Grid.Column="1" Margin="0,46,2,0" KeyDown="txt_KeyDown" PreviewMouseLeftButtonDown="txtPrevMouseDown" GotFocus="txtGotFocus" Style="{DynamicResource LightTextBoxStyle}"/>
		<TextBox x:Name="txtL" HorizontalAlignment="Right" TextWrapping="NoWrap" Width="46" FontSize="11" Height="18" VerticalAlignment="Top" Grid.Column="1" Margin="0,66,2,0" KeyDown="txt_KeyDown" PreviewMouseLeftButtonDown="txtPrevMouseDown" GotFocus="txtGotFocus" Style="{DynamicResource LightTextBoxStyle}"/>
		<TextBox x:Name="txtA" HorizontalAlignment="Right" TextWrapping="NoWrap" Width="46" FontSize="11" Height="18" VerticalAlignment="Top" Grid.Column="1" Margin="0,86,2,0" KeyDown="txt_KeyDown" PreviewMouseLeftButtonDown="txtPrevMouseDown" GotFocus="txtGotFocus" Style="{DynamicResource LightTextBoxStyle}"/>
		<TextBox x:Name="txtR" HorizontalAlignment="Right" TextWrapping="NoWrap" Width="46" FontSize="11" Height="18" VerticalAlignment="Top" Grid.Column="1" Margin="0,106,2,0" KeyDown="txt_KeyDown" PreviewMouseLeftButtonDown="txtPrevMouseDown" GotFocus="txtGotFocus" Style="{DynamicResource LightTextBoxStyle}"/>
		<TextBox x:Name="txtG" HorizontalAlignment="Right" TextWrapping="NoWrap" Width="46" FontSize="11" Height="18" VerticalAlignment="Top" Grid.Column="1" Margin="0,126,2,0" KeyDown="txt_KeyDown" PreviewMouseLeftButtonDown="txtPrevMouseDown" GotFocus="txtGotFocus" Style="{DynamicResource LightTextBoxStyle}"/>
		<TextBox x:Name="txtB" HorizontalAlignment="Right" TextWrapping="NoWrap" Width="46" FontSize="11" Height="18" VerticalAlignment="Top" Grid.Column="1" Margin="0,146,2,0" KeyDown="txt_KeyDown" PreviewMouseLeftButtonDown="txtPrevMouseDown" GotFocus="txtGotFocus" Style="{DynamicResource LightTextBoxStyle}"/>

		<Label Content="H:" HorizontalAlignment="Right" Margin="0,24,46,0" VerticalAlignment="Top" Height="22" Width="19" RenderTransformOrigin="0.475,1.02" FontSize="11" TextOptions.TextFormattingMode="Display" Grid.Column="1"/>
		<Label Content="S:" HorizontalAlignment="Right" Margin="0,44,46,0" VerticalAlignment="Top" Height="22" Width="19" RenderTransformOrigin="0.475,1.02" FontSize="11" TextOptions.TextFormattingMode="Display" Grid.Column="1"/>
		<Label Content="L:" HorizontalAlignment="Right" Margin="0,64,46,0" VerticalAlignment="Top" Height="22" Width="19" RenderTransformOrigin="0.475,1.02" FontSize="11" TextOptions.TextFormattingMode="Display" Grid.Column="1"/>
		<Label Content="A:" HorizontalAlignment="Right" Margin="0,84,46,0" VerticalAlignment="Top" Height="22" Width="19" RenderTransformOrigin="0.475,1.02" FontSize="11" TextOptions.TextFormattingMode="Display" Grid.Column="1"/>
		<Label Content="R:" HorizontalAlignment="Right" Margin="0,104,46,0" VerticalAlignment="Top" Height="22" Width="19" RenderTransformOrigin="0.475,1.02" FontSize="11" TextOptions.TextFormattingMode="Display" Grid.Column="1"/>
		<Label Content="G:" HorizontalAlignment="Right" Margin="0,124,46,0" VerticalAlignment="Top" Height="22" Width="19" RenderTransformOrigin="0.475,1.02" FontSize="11" TextOptions.TextFormattingMode="Display" Grid.Column="1"/>
		<Label Content="B:" HorizontalAlignment="Right" Margin="0,143,46,0" VerticalAlignment="Top" Height="22" Width="19" RenderTransformOrigin="0.475,1.02" FontSize="11" TextOptions.TextFormattingMode="Display" Grid.Column="1"/>
		<Button x:Name="btnOK" Content="OK" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="67" Margin="0,0,5,36" Height="22" Grid.Column="1" Click="btnOK_Click" Style="{StaticResource LightButtonStyle}" TextOptions.TextFormattingMode="{StaticResource TxtFormatMode}" Grid.Row="1" Foreground="{StaticResource LControlForeground}"/>
		<Button x:Name="btnCancel" Content="Cancel" Margin="0,0,5,9" HorizontalAlignment="Right" Width="67" Height="22" VerticalAlignment="Bottom" Grid.Column="1" Click="btnCancel_Click" Style="{StaticResource LightButtonStyle}" TextOptions.TextFormattingMode="{StaticResource TxtFormatMode}" Foreground="{StaticResource LControlForeground}" Grid.Row="1"/>
		<ToggleButton x:Name="btnToggleColorSet" Content="ColorSet: disabled" HorizontalAlignment="Left" Height="22" Margin="10,66,0,0" Grid.Row="1" Style="{DynamicResource LightToggleButtonStyle}" VerticalAlignment="Top" Width="153" FontSize="10.667" TextOptions.TextFormattingMode="Display" Background="White" Foreground="#FF1F1F1F" BorderBrush="Red" Effect="{DynamicResource BtnFxNormal}" Checked="btnTogglePalette_Checked" Unchecked="btnTogglePalette_Unchecked"/>
		<Button x:Name="btnLoadPalette" VerticalAlignment="Bottom" Height="27" Click="btnLoadPalette_Click" Style="{StaticResource LightButtonStyle}" TextOptions.TextFormattingMode="{StaticResource TxtFormatMode}" Foreground="{DynamicResource LControlForeground}" Grid.Column="1" Margin="0,0,42,69" Grid.Row="1" HorizontalAlignment="Right" Width="30" Content="▲"/>
		<Button x:Name="btnSavePalette" VerticalAlignment="Bottom" Height="27" Click="btnSavePalette_Click" Style="{StaticResource LightButtonStyle}" TextOptions.TextFormattingMode="{StaticResource TxtFormatMode}" Foreground="{DynamicResource LControlForeground}" Grid.Column="1" Margin="0,0,5,69" Grid.Row="1" HorizontalAlignment="Right" Width="30" Content="▼"/>

		<Grid Margin="168,0,10,7" Grid.Row="1" MaxWidth="160" HorizontalAlignment="Stretch">
			<Grid.RowDefinitions>
				<RowDefinition Height="1*"/>
				<RowDefinition Height="1*"/>
				<RowDefinition Height="1*"/>
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="1*"/>
				<ColumnDefinition Width="1*"/>
				<ColumnDefinition Width="1*"/>
				<ColumnDefinition Width="1*"/>
				<ColumnDefinition Width="1*"/>
			</Grid.ColumnDefinitions>
			<Button x:Name="btnColor0" Tag="0" Margin="1,1,2,2" Grid.Column="0" Grid.Row="0" Style="{DynamicResource LightPaletteButtonStyle}" Click="btnPalette_Click"/>
			<Button x:Name="btnColor1" Tag="1" Margin="1,1,2,2" Grid.Column="1" Grid.Row="0" Style="{DynamicResource LightPaletteButtonStyle}" Click="btnPalette_Click"/>
			<Button x:Name="btnColor2" Tag="2" Margin="1,1,2,2" Grid.Column="2" Grid.Row="0" Style="{DynamicResource LightPaletteButtonStyle}" Click="btnPalette_Click"/>
			<Button x:Name="btnColor3" Tag="3" Margin="1,1,2,2" Grid.Column="3" Grid.Row="0" Style="{DynamicResource LightPaletteButtonStyle}" Click="btnPalette_Click"/>
			<Button x:Name="btnColor4" Tag="4" Margin="1,1,2,2" Grid.Column="4" Grid.Row="0" Style="{DynamicResource LightPaletteButtonStyle}" Click="btnPalette_Click"/>

			<Button x:Name="btnColor5" Tag="5" Margin="1,1,2,2" Grid.Column="0" Grid.Row="1" Style="{DynamicResource LightPaletteButtonStyle}" Click="btnPalette_Click"/>
			<Button x:Name="btnColor6" Tag="6" Margin="1,1,2,2" Grid.Column="1" Grid.Row="1" Style="{DynamicResource LightPaletteButtonStyle}" Click="btnPalette_Click"/>
			<Button x:Name="btnColor7" Tag="7" Margin="1,1,2,2" Grid.Column="2" Grid.Row="1" Style="{DynamicResource LightPaletteButtonStyle}" Click="btnPalette_Click"/>
			<Button x:Name="btnColor8" Tag="8" Margin="1,1,2,2" Grid.Column="3" Grid.Row="1" Style="{DynamicResource LightPaletteButtonStyle}" Click="btnPalette_Click"/>
			<Button x:Name="btnColor9" Tag="9" Margin="1,1,2,2" Grid.Column="4" Grid.Row="1" Style="{DynamicResource LightPaletteButtonStyle}" Click="btnPalette_Click"/>

			<Button x:Name="btnColor10" Tag="10" Margin="1,1,2,2" Grid.Column="0" Grid.Row="2" Style="{DynamicResource LightPaletteButtonStyle}" Click="btnPalette_Click"/>
			<Button x:Name="btnColor11" Tag="11" Margin="1,1,2,2" Grid.Column="1" Grid.Row="2" Style="{DynamicResource LightPaletteButtonStyle}" Click="btnPalette_Click"/>
			<Button x:Name="btnColor12" Tag="12" Margin="1,1,2,2" Grid.Column="2" Grid.Row="2" Style="{DynamicResource LightPaletteButtonStyle}" Click="btnPalette_Click"/>
			<Button x:Name="btnColor13" Tag="13" Margin="1,1,2,2" Grid.Column="3" Grid.Row="2" Style="{DynamicResource LightPaletteButtonStyle}" Click="btnPalette_Click"/>
			<Button x:Name="btnColor14" Tag="14" Margin="1,1,2,2" Grid.Column="4" Grid.Row="2" Style="{DynamicResource LightPaletteButtonStyle}" Click="btnPalette_Click"/>
		</Grid>

		<Popup x:Name="palettePopup" Placement="Left">
			<Grid>
			<Rectangle x:Name="popupRectangle" Stroke="Black" RadiusY="5" RadiusX="5" Fill="#FFE5E5E5"/>
			<StackPanel Height="112" Width="156">
				<Grid Height="4">
				</Grid>
				<TextBox x:Name="txtColorName" TextWrapping="NoWrap" FontSize="14" PreviewMouseLeftButtonDown="txtPrevMouseDown" GotFocus="txtGotFocus" Style="{DynamicResource LightTextBoxStyle}" Margin="10,2" Height="22"/>
				<Button x:Name="btnLoadColorFront" VerticalAlignment="Bottom" Height="22" Click="btnLoadFrontColor_Click" Style="{StaticResource LightButtonStyle}" TextOptions.TextFormattingMode="{StaticResource TxtFormatMode}" Foreground="{DynamicResource LControlForeground}" Margin="10,2" Content="  ▲ Load to Front color" HorizontalContentAlignment="Left"/>
				<Button x:Name="btnLoadColorBack" VerticalAlignment="Bottom" Height="22" Click="btnLoadBackColor_Click" Style="{StaticResource LightButtonStyle}" TextOptions.TextFormattingMode="{StaticResource TxtFormatMode}" Foreground="{DynamicResource LControlForeground}" Margin="10,2" Content="  ▲ Load to Back color" HorizontalContentAlignment="Left"/>
				<Button x:Name="btnSaveColor" VerticalAlignment="Bottom" Height="22" Click="btnSaveColor_Click" Style="{StaticResource LightButtonStyle}" TextOptions.TextFormattingMode="{StaticResource TxtFormatMode}" Foreground="{DynamicResource LControlForeground}" Margin="10,2" Content="  ▼ Save Front color" HorizontalContentAlignment="Left" Padding="1"/>
			</StackPanel>
			</Grid>
		</Popup>
	</Grid>
</Window>
